﻿namespace NTrace
{
  using System;
  using ICSharpCode.NRefactory.PrettyPrinter;

  public class CSharpLanguage : TargetLanguage
  {
    public override IOutputAstVisitor CreatePrinter()
    {
      return new CSharpOutputVisitor();
    }

    public override OriginalSourceWrapper CreateSourceWrapper(String fileName, System.IO.TextWriter writer)
    {
      return new CSharpSourceWrapper(fileName, writer);
    }

    private class CSharpSourceWrapper : OriginalSourceWrapper
    {
      public CSharpSourceWrapper(String fileName, System.IO.TextWriter writer) : base(fileName, writer)
      {
        writer.WriteLine("#line 1 \"{0}\"", fileName);
      }

      public override void Dispose()
      {
        // NOP
      }
    }
  }
}
